const express = require('express')
const router = express.Router()

const Mock = require('mockjs')
router.get('/mock/test', async (req, res, next) => {
    res.send(Mock.mock({
      status: 'success',
      "addressList|3-9": [{
        "id|+1": 1,
        "name": "@cname(2,3)",
        "address": "@city(true)",
        "addressDetail": "@city(true)",
        'phone': '@string("number", 11, 11)',
        "label": "@ctitle(1, 3)",
        "email": "@email"
    }],
    'capList|10-30': [{
      'num': '@string("number", 13,13)',
      'order': '@string("number", 9,13)',
      'price|1-100.1-2': 1,
      'balance|1-100000.1-2': 20000,
      'time': '@date("yyyy-yy-y MM:M:dd:d")',
      "name": "@cname(2,3)",

    }],
    'zhangdanList|10-30': [{
      'time': '@date("yyyy-yy-y MM:M:dd:d")',
      'day|1-100': 50,
      'price|1-100.1-2': 1,
      'total|1-100': 50,
      'yifu|1-100000.1-2': 1,
      'qian|1-1000000.1-2': 1,
      'createTime': '@date("yyyy-yy-y MM:M:dd:d")',
      "name": "@cname(2,3)",
      "boolean|1": true,

    }],

    'orderList|3-10': [{
      'order': '@string("number", 9,13)',
      'time': '@date("yyyy-yy-y MM:M:dd:d")',
      "name": "画册-210x285mm-封面铜版纸250g-内页32P铜版纸200g-骑马钉-3000本-碧桂园地产",
      'img': '@image()',
      'price|1-100.1-2': 1,
      "tit": "@cname(2,3)",
      "state": "@cname(2,3)"

    }],

    }))
})

router.get('/mock/product', async (req, res, next) => {
  res.send(Mock.mock({
    status: 'success',
    "data": {
      'public': {
        'detailList|3': [
          {
            'name': '@ctitle(1, 6)',
            'img': '@image()',
            'detail': "@image('800x13000')"
          }
        ],
        'sizes': {
          'size|1-5': [{
            'title': "@ctitle(1, 6)" + '小号',
            'id': '@string("number")'
          }],
          'custom|3': [
            {
              'title': '长',
              'value': ''
            }
          ]
        },
        'amount|3-5': [{
          "title": "@string('number')",
          "value": ''
        }],
        "custom": {
          "list|5": [{
            "title": '@cname()'
          }]
        }
      }
    }
  }))
})
module.exports = router